home *** CD-ROM | disk | FTP | other *** search
- unit SBarU;
-
- interface
-
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- ComCtrls, ExtCtrls;
-
- type
- TForm1 = class(TForm)
- Bar: TStatusBar;
- ImageList1: TImageList;
- Timer1: TTimer;
- procedure FormCreate(Sender: TObject);
- procedure BarDrawPanel(StatusBar: TStatusBar; Panel: TStatusPanel;
- const Rect: TRect);
- procedure Timer1Timer(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- var
- Form1: TForm1;
-
- implementation
-
- {$R *.DFM}
-
- procedure TForm1.FormCreate(Sender: TObject);
- begin
- //Ensure that the timer's event handler is
- //triggered as soon as the form is created
- if Assigned(Timer1.OnTimer) then
- Timer1.OnTimer(Timer1)
- end;
-
- procedure TForm1.BarDrawPanel(StatusBar: TStatusBar; Panel: TStatusPanel;
- const Rect: TRect);
- const
- //Start with the first image
- Index: Integer = 0;
- begin
- //Draw image on the status panel
- ImageList1.Draw(Bar.Canvas, Rect.Left, Rect.Top, Index);
- //Make sure a different image is used next time
- Index := Succ(Index) mod ImageList1.Count
- end;
-
- procedure TForm1.Timer1Timer(Sender: TObject);
- begin
- //Get status bar to redraw itself
- Bar.Invalidate
- end;
-
- end.
-